package com.sunyard.dal.dto;

import com.sunyard.utils.manage.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 终端预警查询返回实体
 */

@ApiModel
public class KeyWarningQueryDTO {

    @ApiModelProperty(value = "id")
    private Integer id;

    // 钥匙名称
    @ApiModelProperty(value = "钥匙名称")
    private String keyName;

    // 终端种类 1指纹终端 2物联网终端 3动码终端
    @ApiModelProperty(value = "终端种类 1指纹终端 2物联网终端 3动码终端")
    private String keyType;

    // mac地址
    @ApiModelProperty(value = "mac地址")
    private String mac;

    // 机构名称
    @ApiModelProperty(value = "机构名称")
    private String orgName;

    // 备注
    @ApiModelProperty(value = "备注")
    private String remark;

    // 在线时间
    @ApiModelProperty(value = "在线时间")
    private String lastTime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getKeyName() {
        return keyName;
    }

    public void setKeyName(String keyName) {
        this.keyName = keyName;
    }

    public String getKeyType() {
        return keyType;
    }

    public void setKeyType(String keyType) {
        this.keyType = keyType;
    }

    public String getOrgName() {
        return orgName;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getLastTime() {
        if (lastTime != null && !"".equals(lastTime)) {
            if ("0".equals(lastTime)) {
                return "从未上传";
            } else {
                Long timestamp = Long.parseLong(lastTime);
                String date = new SimpleDateFormat(DateUtil.YYYYMMDD_HHMMSS, Locale.CHINA).format(new Date(timestamp));
                return date;
            }
        } else {
            return "";
        }
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }
}
